

import java.io.IOException;
import java.lang.reflect.Method;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public abstract class ControlServlet extends HttpServlet {

	public ControlServlet() {
		super();
	}

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
				// TODO Auto-generated method stub
				System.out.println("board..............");
				
				String ctxPath = request.getContextPath();
				String path = request.getPathInfo().substring(1);
				String uri = request.getRequestURI();
				
				System.out.println(ctxPath);
				System.out.println(path);
				System.out.println(uri);
				
				
				Class clz = this.getClass();
				try{
					Method targetMethod = clz.getMethod(path, HttpServletRequest.class,HttpServletResponse.class);
					
					targetMethod.invoke(this, request, response);
					
				}catch(Exception e){
					e.printStackTrace();
				}
				
				
				
			}

}